from fastapi import APIRouter, Depends
from app.api.deps import get_current_user, SessionDep
from app.crud.waveup.wp_collection import get_collection_list
from app.schemas.waveup.wp_collection import WPCollectionListQueryReq, WpCollectionOut
from app.core.logger import logger

router = APIRouter(prefix="/wp-collection", tags=["WaveUp 藏品"])

@router.post("/list", dependencies=[Depends(get_current_user)])
async def get_wp_collections(
    session: SessionDep,
    query: WPCollectionListQueryReq,
):
    res = await get_collection_list(session, query)
    # 转换为WpCollectionOut模型
    res["records"] = [WpCollectionOut.model_validate(item.model_dump()) for item in res["records"]]
    return res
